package com.monkeygroup.mygoplus.common.utils.image;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import java.io.File;

/**
 * Created by lcw on 2017/6/1.
 */

public abstract class ImageHandler {
    protected Context context;
    protected Integer resId;
    protected Uri uri;
    protected File file;
    protected boolean resize = false;
    protected int width;
    protected int height;

    public ImageHandler(Context context) {
        this.context = context;
    }

    public ImageHandler load(Integer resId) {
        this.resId = resId;
        return this;
    }

    public ImageHandler load(Uri uri) {
        this.uri = uri;
        return this;
    }

    public ImageHandler load(File file) {
        this.file = file;
        return this;
    }

    public ImageHandler resize(int width, int height) {
        this.resize = true;
        this.width = width;
        this.height = height;
        return this;
    }

    public abstract void into(ImageView target);
    public abstract void invalidate(Uri uri);
    public abstract void invalidate(File file);
}
